<?php

class Language
{
    private $locale;
    private $lang;
    private $consts;
    
    public function __construct()
    {
        $lang_type = $_GET['l'];
        if($lang_type!='vi'){
            $this->locale = 'en';
        } else {
            $this->locale = 'vi';
        }
        include_once __dir__ . '/const.php';
        include_once __dir__ . '/' . $this->locale . '.php';
        $this->lang = $lang;
        $this->consts = $consts;
    }

    public function get($key){
        $aKey = explode('.', $key);
        $lang = $this->lang;
        foreach ($aKey as $value) {
            $lang = $lang[$value];
        }
        return $lang;
    }

    public function getConst($key){
        return $this->consts[$key];
    }
}
?>